package com.nettylearning.base.netty.io.bio.tomcat;

import java.io.OutputStream;

/**
 * @author vince
 * @date 2021/7/24 22:54
 * @Version 1.0
 */
public class GPResponse {
    private OutputStream outputStream;

    public GPResponse(OutputStream outputStream) {
        this.outputStream = outputStream;
    }

    public void write(String s) throws Exception {
        // 输出也要遵循HTTP
        // 状态码200
        StringBuilder sb = new StringBuilder();
        sb.append("HTTP/1.1 200 OK\n")
                .append("Content-Type: text/html;\n")
                .append("\r\n")
                .append(s);
        outputStream.write(sb.toString().getBytes());
    }
}
